package indi.henry.demo.service;

import javax.validation.constraints.NotBlank;

import org.springframework.validation.annotation.Validated;

import indi.henry.demo.model.Counter;

/**
 * The services for redis operation
 * 
 * @author Henry Hu
 */
@Validated
public interface RedisService {
    
    /**
     * Get the url by shortened url as id
     * 
     * @param id shortened by ShortenService
     * @return the original url
     * @see ShortenService
     */
    public String getUrlById(@NotBlank String id);

    /**
     * Store the url with shortened id to redis
     * 
     * @param id shortened by ShortenService
     * @param url the original url
     * @see ShortenService
     */
    public void setUrlWithId(@NotBlank String id, @NotBlank String url);

    /**
     * Get the counter from redis
     * 
     * @param counterId
     * @return the counter stored in redis
     */
    public Counter getCounter(String counterId);

    /**
     * Store the counter to redis
     * 
     * @param counterId
     * @param counter to be stored
     */
    public void setCounter(String counterId, Counter counter);
}
